add_library(ao SHARED direct/ao.cpp)
add_library(direct SHARED direct/direct.cpp)
add_library(path SHARED path/path.cpp)
add_library(guided_path SHARED path/guided_path.cpp)
add_library(volpath SHARED path/volpath.cpp)
add_library(volpath_simple SHARED path/volpath_simple.cpp)
add_library(ptracer SHARED ptracer/ptracer_proc.h ptracer/ptracer.cpp ptracer/ptracer_proc.cpp)
add_library(photonmapper SHARED photonmapper/photonmapper.cpp photonmapper/bre.cpp photonmapper/bre.h)
add_library(ppm SHARED photonmapper/ppm.cpp)
add_library(sppm SHARED photonmapper/sppm.cpp)
add_library(vpl SHARED vpl/vpl.cpp)
add_library(adaptive SHARED misc/adaptive.cpp)
add_library(irrcache SHARED misc/irrcache.cpp misc/irrcache_proc.cpp misc/irrcache_proc.h)
add_library(multichannel SHARED misc/multichannel.cpp)
add_library(field SHARED misc/field.cpp)
add_library(motion SHARED misc/motion.cpp)

target_link_libraries(ao mitsuba-python)
target_link_libraries(direct mitsuba-python)
target_link_libraries(path mitsuba-python)
target_link_libraries(guided_path mitsuba-python)
target_link_libraries(volpath mitsuba-python getopt)
target_link_libraries(volpath_simple mitsuba-python)
target_link_libraries(ptracer mitsuba-python)
target_link_libraries(photonmapper mitsuba-python)
target_link_libraries(ppm mitsuba-python)
target_link_libraries(sppm mitsuba-python)
target_link_libraries(vpl mitsuba-python)
target_link_libraries(adaptive mitsuba-python)
target_link_libraries(irrcache mitsuba-python)
target_link_libraries(multichannel mitsuba-python)
target_link_libraries(field mitsuba-python)
target_link_libraries(motion mitsuba-python)

set_target_properties(ao PROPERTIES FOLDER "plugins")
set_target_properties(direct PROPERTIES FOLDER "plugins")
set_target_properties(path PROPERTIES FOLDER "plugins")
set_target_properties(guided_path PROPERTIES FOLDER "plugins")
set_target_properties(volpath PROPERTIES FOLDER "plugins")
set_target_properties(volpath_simple PROPERTIES FOLDER "plugins")
set_target_properties(ptracer PROPERTIES FOLDER "plugins")
set_target_properties(photonmapper PROPERTIES FOLDER "plugins")
set_target_properties(ppm PROPERTIES FOLDER "plugins")
set_target_properties(sppm PROPERTIES FOLDER "plugins")
set_target_properties(vpl PROPERTIES FOLDER "plugins")
set_target_properties(adaptive PROPERTIES FOLDER "plugins")
set_target_properties(irrcache PROPERTIES FOLDER "plugins")
set_target_properties(multichannel PROPERTIES FOLDER "plugins")
set_target_properties(field PROPERTIES FOLDER "plugins")
set_target_properties(motion PROPERTIES FOLDER "plugins")

add_library(bdpt SHARED bdpt/bdpt.h bdpt/bdpt_wr.h bdpt/bdpt_proc.h bdpt/bdpt.cpp bdpt/bdpt_wr.cpp bdpt/bdpt_proc.cpp)
add_library(pssmlt SHARED pssmlt/pssmlt.h pssmlt/pssmlt_sampler.h pssmlt/pssmlt_proc.h pssmlt/pssmlt.cpp pssmlt/pssmlt_sampler.cpp pssmlt/pssmlt_proc.cpp)
add_library(mlt SHARED mlt/mlt.h mlt/mlt_proc.h mlt/mlt.cpp mlt/mlt_proc.cpp)
add_library(erpt SHARED erpt/erpt.cpp erpt/erpt_proc.cpp erpt/erpt.h erpt/erpt_proc.h)

target_link_libraries(bdpt mitsuba-bidir)
target_link_libraries(pssmlt mitsuba-bidir)
target_link_libraries(mlt mitsuba-bidir)
target_link_libraries(erpt mitsuba-bidir)

set_target_properties(bdpt PROPERTIES FOLDER "plugins")
set_target_properties(pssmlt PROPERTIES FOLDER "plugins")
set_target_properties(mlt PROPERTIES FOLDER "plugins")
set_target_properties(erpt PROPERTIES FOLDER "plugins")